Simple Usage:
import ScatterGL from "epiviz.scatter.gl";
# you can either pass in a dom selector or HTMLElement
let plot = new ScatterGL(".canvas");
# provide input data to the element,
# data must contain x and y coordinates
plot.setInput({
x: [...],
y: [...],
});
# render the plot
plot.render();
Capture events:
The library provides click, hover (mouseover) and selection events to provide interactions with the plot. The default behavior logs the points to the console, but can be overwritten
plot.hoverCallback = function(point) {
# do something when a point is hovered
console.log(point);
}
Interactions:
currently supports
- pan: for pan/zoom operations on canvas
- box: box selection of data points
- lasso: lasso selection
plot.setInteraction("lasso");